package ptij.vocoder.baseModel;

import ptolemy.actor.*;
import ptolemy.kernel.*;
import ptolemy.kernel.util.*;
import ptolemy.data.ObjectToken;
import ptolemy.data.type.*;

import ptij.vocoder.baseModel.*;

//////////////////////////////////////////////////////////////////////////
//// FrameBuffer
/** 

@author Ivan Jeukens
@version v 0.1 07/08/2003
*/
public class FrameBuffer extends TypedAtomicActor {

    public FrameBuffer(CompositeEntity container, String name) throws
            IllegalActionException, NameDuplicationException {
        super(container, name);

        input = new TypedIOPort(this, "input", true, false);
        input.setTypeEquals(BaseType.OBJECT);

        output_tolpc = new TypedIOPort(this, "output_tolpc", false, true);
        output_tolpc.setTypeEquals(BaseType.OBJECT);
        
        output_tool = new TypedIOPort(this, "output_tool", false, true);
        output_tool.setTypeEquals(BaseType.OBJECT);
    }

    ///////////////////////////////////////////////////////////////////
    ////                     ports and parameters                  ////

    // Input ports
    public TypedIOPort input;

    // Output Ports
    public TypedIOPort output_tolpc;
    public TypedIOPort output_tool;
    
    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////

    public void initialize() throws IllegalActionException {
        super.initialize();
        _init();
    }

    public void fire() throws IllegalActionException {
        ObjectToken obj = (ObjectToken) input.get(0);
        Short [] newframe = (Short []) obj.getValue();
        
        output_tolpc.broadcast(new ObjectToken(newframe));

        output_tool.broadcast(new ObjectToken(newframe));
    }

    ///////////////////////////////////////////////////////////////////
    ////                         private methods                   ////

    
    
    
    private void _init() {
        
    }

    ///////////////////////////////////////////////////////////////////
    ////                         private variables                 ////

}
